package com.zd.bms.service;

import java.util.Map;

import org.springframework.transaction.annotation.Transactional;

import com.zd.bms.bean.vo.req.BmsUserListReqVo;
import com.zd.bms.bean.vo.resp.BmsUserRespVo;
import com.zd.common.bean.model.BmsUser;
import com.zd.common.dao.common.Page;
import com.zd.common.service.IBaseService;

public interface IBmsUserService extends IBaseService<BmsUser> {
	/**
	 * 根据 用户名密码找用户
	 * @param username
	 * @param password
	 * @return
	 * @throws Exception
	 */
	BmsUser findUser(String username, String password) throws Exception;

	/**
	 * 根据 用户名找用户
	 * @param username
	 * @param password
	 * @return
	 * @throws Exception
	 */
	BmsUser findUser(String username) throws Exception;
	
	
	/**
	 * 加载用户角色权限相关的东西
	 * 
	 * @param bmsUser
	 * @return
	 * @throws Exception
	 */
	Map<String, Object> loadBmsUserRoleResource(BmsUser bmsUser) throws Exception;

	/**
	 * 分页查询用户
	 * 
	 * @param req
	 * @return
	 * @throws Exception
	 */
	Page<BmsUserRespVo> pageBmsUser(BmsUserListReqVo req) throws Exception;

	/**
	 * 新增或者修改用户
	 * 
	 * @param bmsUser
	 * @return
	 * @throws Exception
	 */
	@Transactional
	Map<String, Object> saveOrUpdateUser(BmsUser bmsUser) throws Exception;
	
	/**
	 * 修改用户密码
	 * @param oldPwd 当前密码
	 * @param newPwd 新密码
	 * @return
	 * @throws Exception
	 */
	Map<String, Object> updatePwd(String oldPwd, String newPwd, BmsUser bmsUser)throws Exception;
}
